import React, { Component } from 'react';
import axios from 'axios'
class App extends Component {
  getStudentData = async () => {
    const { data: res } = await axios.get('/api1/students')
    console.log('学生:', res)
  }
  getCarData = async () => {
    const { data: res } = await axios.get('/api2/cars')
    console.log('汽车:', res)
  }
  render() {
    return (
      <div>
        <button onClick={this.getStudentData}>获取学生数据</button>
        <button onClick={this.getCarData}>获取汽车数据</button>
      </div>
    )
  }
}

export default App;